package com.cskaoyan.controller.wx_aftersale;

import com.cskaoyan.bean.BaseParam;
import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.PageDataVo;
import com.cskaoyan.bean.user.User;
import com.cskaoyan.bean.wx_aftersale.WxAfterSaleListVO;
import com.cskaoyan.service.wx_aftersale.WxAfterSaleService;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:
 * @author: enhui
 **/
@RestController
@RequestMapping("wx/aftersale")
public class WxAfterSaleController {
    @Autowired
    WxAfterSaleService wxAfterSaleService;

    @RequestMapping("list")
    public BaseRespVo afterSaleList(Short status, BaseParam baseParam) {
        User user = (User) SecurityUtils.getSubject().getPrincipals()
                .getPrimaryPrincipal();//获取已登录的用户信息.
        Integer userId = user.getId();
        if (userId == null) return BaseRespVo.error("请登录");
        PageDataVo wxAfterSaleListVO = wxAfterSaleService.afterSaleList(status, userId, baseParam);
        return BaseRespVo.ok(wxAfterSaleListVO);
    }

}
